package com.zyt.springboot.learnLambda;

import java.util.ArrayList;
import java.util.List;
import java.util.function.IntPredicate;

/*
 * 腾哥专用代码防伪标志！！！
 * @params:
 */
public class test1 {
    public static void main(String[] args) {

        List<String> list1 = new ArrayList<>();
        ArrayList<String> list2 = new ArrayList<>();
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("啦啦啦");
            }
        }).start();
        new Thread(()->{
            System.out.println("lalala");
        }).start();
        new Thread(()-> System.out.println("lalala")).start();

        MyInterface a = new MyInterface() {
            @Override
            public int addInt3(int a, int b) {
                return 0;
            }

        };
        MyInterface b = (int a1, int b1)-> {
                return 0;
        };
        MyInterface c = (a1, b1) -> a1+b1;

        MyInterface d = Integer::sum;

        printNum(new IntPredicate() {
            @Override
            public boolean test(int value) {
                return value%2==0;
            }
        });

        printNum((int value) -> {
            return value%2==0;
        });

        printNum((int value) -> value%2==0);

        printNum(value -> value%2==0);

        IntPredicate num1 = i -> i%2==0;
        num1.test(20);
        num1.test(21);

    }
    public static void printNum(IntPredicate intPredicate){
        int[] arr = {1,2,3,4,5,6,7,8,9,10};
        for (int i : arr) {
            if(intPredicate.test(i)){
                System.out.println(i);
            }
        }
    }





}
